package org.train.model.impl;

import org.train.model.Locomotive;
import org.train.model.PassangerCar;

public class MetroCar implements Locomotive, PassangerCar {
	private double weight;
	private double maxSpeed;
	private double power;
	private int maxCapacity;

	@Override
	public double getWeight() {
		return weight;
	}

	@Override
	public double getMaxSpeed() {
		return maxSpeed;
	}

	@Override
	public double getPower() {
		return power;
	}

	@Override
	public int getMaxCapacity() {
		return maxCapacity;
	}

	@Override
	public MetroCar clone() {
		return new MetroCar(weight, maxSpeed, power, maxCapacity);
	}

	public MetroCar(double weight, double maxSpeed, double power,
			int maxCapacity) {
		this.weight = weight;
		this.maxSpeed = maxSpeed;
		this.power = power;
		this.maxCapacity = maxCapacity;
	}

	public MetroCar(Builder builder) {
		this.weight = builder.weight;
		this.maxSpeed = builder.maxSpeed;
		this.power = builder.power;
		this.maxCapacity = builder.maxCapacity;
	}

	public static class Builder {
		private double weight;
		private double maxSpeed;
		private double power;
		private int maxCapacity;

		public Builder() {

		}

		public Builder weight(double weight) {
			this.weight = weight;
			return this;
		}

		public Builder power(double power) {
			this.power = power;
			return this;
		}

		public Builder maxSpeed(double maxSpeed) {
			this.maxSpeed = maxSpeed;
			return this;
		}

		public Builder maxCapacity(int maxCapacity) {
			this.maxCapacity = maxCapacity;
			return this;
		}

		public MetroCar build() {
			return new MetroCar(this);
		}

	}

}
